home *** CD-ROM | disk | FTP | other *** search
/ CD World Haziran 1997 / CD World Haziran 1997.iso / Explorer Yardimcilari / PiXCL Tools / Profile.px_ / Profile.px
Encoding:
Text File  |  1996-05-10  |  3.3 KB  |  137 lines

  1.      UseCoordinates(PIXEL)
  2.     UseFont("Arial",5,15,NOBOLD,NOITALIC,NOUNDERLINE,0,0,255)
  3.  
  4.     SetColorPalette(GENERATE)
  5.     
  6.     WinGetActive(Win$)
  7.     Title$ = "Profiling Pixel Values"
  8.     WinTitle(Win$,Title$)
  9.     WinLocate("Profiling Pixel Values",200,100,760,470,Res)
  10.     WinShow("Profiling Pixel Values",TOPMOST,Res)
  11.     DirGet(SourceDir$)
  12.     
  13.     UseBrush(SOLID,128,128,128)
  14.  
  15.     InfoMenu(REMOVE)
  16.     SetMenu("File",IGNORE,
  17.         "E&xit",Leave,
  18.         ENDPOPUP,
  19.         "&Help",Help,
  20.         ENDPOPUP,
  21.         "&About",About,
  22.         ENDPOPUP)
  23.     DrawText(100,50,"Click anywhere to start")
  24.     SetMouse(0,0,400,370,Profile,X,Y)
  25.  
  26. Wait_for_Input:
  27.     WaitInput()
  28.  
  29. Leave:
  30.     End
  31.  
  32. About:
  33.     AboutUser("About Profile","PiXCLpro 4.0 Sample program","")
  34.     Goto Wait_for_Input
  35.     
  36. Profile:
  37.     UseBackground(TRANSPARENT,192,192,192)
  38.     DrawBackGround
  39.     SetMouse(0,0,400,370,Start,X,Y)
  40.     SetRightMouse()
  41.     
  42. Start:
  43.     SetColorPalette(GENERATE)
  44.     DrawBitMap(0,0,"geol.bmp"){400x324}
  45.     UseCaption(Title$)
  46.     UsePen(NULL,1,0,0,0)
  47.     UseBrush(SOLID,255,255,255)
  48.  
  49.     DrawEdgeRectangle(400,0,420,324,RAISEDEDGE,ADJUST,LEFT)
  50.  
  51.     DrawEdgeRectangle(408,1,542,86,SUNKENEDGE,ADJUST,RECT)
  52.     DrawEdgeRectangle(408,89,542,174,SUNKENEDGE,ADJUST,RECT)
  53.     DrawEdgeRectangle(408,179,542,264,SUNKENEDGE,ADJUST,RECT)
  54.  
  55.     DrawRectangle(410,2,540,84)
  56.     DrawRectangle(410,90,540,172)
  57.     DrawRectangle(410,180,540,262)
  58.  
  59.     X = 0
  60.     Xg = 411
  61.     MaxR = 0 MinR = 255
  62.     MaxG = 0 MinG = 255
  63.     MaxB = 0 MinB = 255
  64.     UseCursor(WAIT)
  65. Loop:
  66.     GetPixel(X,Y,R,G,B,Res)
  67.     If R > MaxR Then MaxR = R
  68.     If G > MaxG Then MaxG = G
  69.     If B > MaxB Then MaxB = B
  70.  
  71.     If R < MinR Then MinR = R
  72.     If G < MinG Then MinG = G
  73.     If B < MinB Then MinB = B
  74.     X = X + 2
  75.     Xg = Xg + 1
  76.     R = R / 4   G = G / 4   B = B / 4
  77.     UsePen(SOLID,1,0,0,255) Y1 = 83 - B
  78.     DrawLine(Xg,83,Xg,Y1)
  79.  
  80.     UsePen(SOLID,1,0,128,0) Y2 = 171 - G
  81.     DrawLine(Xg,171,Xg,Y2)
  82.  
  83.     UsePen(SOLID,1,255,0,0) Y3 = 261 - R
  84.     DrawLine(Xg,261,Xg,Y3)
  85.     If X < 252 Then Goto Loop
  86.     
  87.     DrawNumber(440,4,MinB) DrawNumber(480,4,MaxB)
  88.     DrawNumber(440,92,MinG) DrawNumber(480,92,MaxG)
  89.     DrawNumber(440,182,MinR) DrawNumber(480,182,MaxR)
  90.  
  91.     UsePen(SOLID,1,255,255,255)
  92.     DrawLine(0,Y,400,Y)
  93.  
  94.     UseCursor(ARROW)
  95.     SetRightMouse(410,2,540,84,BluProfile,Xx,Yy,
  96.               410,90,540,172,GrnProfile,Xx,Yy,
  97.               410,180,540,262,RedProfile,Xx,Yy)
  98.  
  99.     Goto Wait_for_Input
  100.  
  101.  
  102. Help:
  103.     MessageBox(OK,1,INFORMATION,
  104. "To run this sample program, click anywhere in the window,
  105. and an image is displayed. The line at the X coordinate 
  106. that you clicked is scanned for the display RGB pixel 
  107. values, and three profiles are drawn to the right of the 
  108. image, plus the minimum and maximum values for each color
  109. in the scanned line.
  110.  
  111. This program is best viewed with a 2MB or better video card.",
  112.     "Profiling Pixel values",Res)
  113.  
  114.     Goto Wait_for_Input
  115.  
  116. RedProfile:
  117.     MessageBox(OK,1,EXCLAMATION,
  118. "These are the pixel values read from the display
  119. memory, not from the image file itself.",
  120.     "Profile of the Red pixels.",Res)
  121.     Goto Wait_for_Input
  122.  
  123. GrnProfile:
  124.     MessageBox(OK,1,EXCLAMATION,
  125. "These are the pixel values read from the display
  126. memory, not from the image file itself.",
  127.     "Profile of the Green pixels.",Res)
  128.     Goto Wait_for_Input
  129.  
  130. BluProfile:
  131.     MessageBox(OK,1,EXCLAMATION,
  132. "These are the pixel values read from the display
  133. memory, not from the image file itself.",
  134.     "Profile of the Blue pixels.",Res)
  135.     Goto Wait_for_Input
  136.  
  137.